package com.binyouwei.designpatterns.structural_type.decorate;

/**
 * @author 宾有为
 * @date 2024/7/11 19:50
 * @link https://blog.csdn.net/baidu_41616022?type=blog
 * @describe：装饰器模式 - 允许向一个现有的对象添加新的功能，同时又不改变其结构。
 **/
public class DecoratorPatternMain {

    public static void main(String[] args) {
        DecorateShape circle = new DecorateCircle();
        DecorateShapeDecorator redCircle = new DecorateRedShapeDecorator(new DecorateCircle());
        DecorateShapeDecorator redRectangle = new DecorateRedShapeDecorator(new DecorateRectangle());
        System.out.println("Circle with normal border");
        circle.draw();

        System.out.println("\nCircle of red border");
        redCircle.draw();

        System.out.println("\nRectangle of red border");
        redRectangle.draw();
    }
}
